﻿using System;
using System.Data;
using System.Configuration;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Web.SessionState;
using PreguntaAlExperto.RulesLayer.Services;
using PreguntaAlExperto.RulesLayer.Entities;
using Microsoft.Security.Application;

namespace PreguntaAlExperto
{
    public class SendAComment
        : IHttpHandler, IRequiresSessionState
    {
        #region IHttpHandler Members

        public bool IsReusable
        {
            get { return true; }
        }

        public void ProcessRequest(HttpContext context)
        {
            if (!string.IsNullOrEmpty(context.Request.QueryString["Comment"]))
            {
                string _validCommentText = AntiXss.HtmlEncode(context.Request.QueryString["Comment"].ToString());
                PublisherService _service = new PublisherService();
                context.Response.Write(_service.InsertGeneralComment(_validCommentText).ToString());
            }
        }

        #endregion
    }
}